import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("region", { schema: "alumni" })
export class Region {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "name", comment: "名称", length: 30 })
  name: string;

  @Column("varchar", { name: "code", comment: "编号", length: 12 })
  code: string;

  @Column("int", {
    name: "parent_id",
    comment: "上级id",
    unsigned: true,
    default: () => "'0'",
  })
  parentId: number;

  @Column("tinyint", {
    name: "level",
    comment: "层级",
    unsigned: true,
    default: () => "'0'",
  })
  level: number;

  @Column("boolean", {
    name: "hot",
  })
  hot: boolean;

  @Column("varchar", {
    name: "pinyin",
    nullable: true,
    comment: "拼音",
    length: 10,
  })
  pinyin: string | null;
}
